<?php
header("content-type:text/html;charset=utf8");
$pdo = new PDO("mysql:host=127.0.0.1;dbname=11-9;charset=utf8",'root','root');
$sql = "select * from excel";
$res = $pdo->query($sql);
$data = $res->fetchAll(PDO::FETCH_ASSOC);
//print_r($data);die;
?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<table border="1">
    <tbody>
    <tr>
        <td>ID</td>
        <td>课程名</td>
        <td>课程时间</td>
        <td>课程数量</td>
        <td>课程教室</td>
        <td>操作</td>
    </tr>
    </tbody>
<?php foreach ($data as $k => $v) {?>
    <tbody>
    <tr>
        <td><?php echo $v['id']?></td>
        <td><?php echo $v['name']?></td>
        <td><?php echo date("Y-m-d ",$v['time'])?></td>
        <td><?php echo $v['num']?></td>
        <td><?php echo $v['class']?></td>
        <td><a href="del.php?id=<?php echo $v['id']?>">删除</a>|<a href="updata.php?id=<?php echo $v['id']?>">修改</a></td>
    </tr>
    </tbody>
    <?php }?>
</table>
<a href="import.php"><button>导入</button></a>
</body>
</html>

